package com.xiangwei.controller;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSONObject;

public class BaseController {
	public void writeInfo(JSONObject object, HttpServletResponse response) throws Exception{
		PrintWriter p ;
		try {
			response.setCharacterEncoding("UTF-8");
			try {
				p= response.getWriter();
				p.print(object);
				p.flush();
				p.close();
			} catch (Exception e1) {
				e1.printStackTrace();
			}
			
		} catch (Exception e) {
			int code = -1;
			p= response.getWriter();
			p.print(code);
			p.flush();
			p.close();
		}
	}
}
